package jianzhi

func ConstructArr(a []int) []int {

	if len(a) == 0 {
		return []int{}
	}

	b := []int{1}

	for i := 1; i < len(a); i++ {
		b = append(b, b[i-1]*a[i-1])
	}

	temp := a[len(a)-1]

	for i := len(a) - 2; i >= 0; i-- {
		b[i] *= temp
		temp *= a[i]
	}

	return b
}
